package com.google.googlemarket.view;

import android.view.View;

import com.google.googlemarket.utils.Logger;

/**
 * Created by Administrator on 2017/9/26.
 */

class MearsureSpecUtil {

    public static void printMeasureSpec(int widthMeasureSpec, int heightMeasureSpec) {
        String widthModeStr = getMode(widthMeasureSpec);
        String hightModeStr = getMode(heightMeasureSpec);
        Logger.i("measureSpec","width:"+widthModeStr+",widthSize:"+ View.MeasureSpec.getSize(widthMeasureSpec));
        Logger.i("measureSpec","hight:"+hightModeStr+",hightSize:"+ View.MeasureSpec.getSize(heightMeasureSpec));
    }

    private static String getMode(int measureSpec) {
        int mode = View.MeasureSpec.getMode(measureSpec);
        String modeStr = (mode == View.MeasureSpec.EXACTLY)?"EXATLY":(mode == View.MeasureSpec.AT_MOST)?"AT_MOST":"UNSPECIFIED";
        return modeStr;
    }
}
